﻿namespace Vkontakte.Api.Operations
{
	[ApiMethod("messages.send")]
	public sealed class MessagesSend
		: Base30ApiOperation
	{

		public MessagesSend()
		{
			
		}

		protected override void Compile()
		{
			AddParameter("method", "messages.send");
			
			AddParameter("message", Message);
			if (UserID!=null)
			{
				AddParameter( "uid", UserID.Value.ToString() );
			}
			if (Title!=null)
			{
				AddParameter( "title", Title );
			}
			if (MessageType==MessageType.Chat)
			{
				AddParameter("type", "1");
			}
			base.Compile();
		}

		protected override void ParseData(string data)
		{
			base.ParseData(data);
		}

		protected internal override bool CheckParams()
		{
			if (Message==null)
			{
				return false;
			}
			return true;
		}


		public string Message
		{
			get; set;
		}

		public string Title
		{
			get; set;
		}

		public long? UserID
		{
			get; set;
		}

		public MessageType MessageType
		{
			get;set;
		}
	}


	public enum MessageType
	{
		Normal=0,
		Chat=1
	}
}